package com.wudgaby.study.jwtauth.controller;

import com.wudgaby.study.jwtauth.dto.AuthUser;
import com.wudgaby.study.jwtauth.support.SecurityContextHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "模拟")
public class HelloController {

    @ApiOperation(value = "问好")
    @GetMapping("/hello")
    public ResponseEntity<String> hello() {
        AuthUser authUser = SecurityContextHolder.getAuthUser();
        return ResponseEntity.status(HttpStatus.OK).body("你好! " + authUser.getUserName());
    }
}
